<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <style>
            div {
                width: 200px;
                height: 200px;
                background-color: orange;
                margin: 0 auto;
            }

        </style>
    </head>
    <body>
        <div></div>
    </body>
    <script>
        var div1=document.querySelector("div")
        // 移动端触摸点击事件
        div1.ontouchstart=function(){
            this.style.backgroundColor="red"
        }
        // 移动事件
        div1.ontouchmove=function(){
            this.style.backgroundColor="green"
        }
        // 点击离开事件
        div1.ontouchend=function(){
            this.style.backgroundColor="pink"
        }
        // 弹框提示事件
        div1.ontouchcancel=function(){
            this.style.backgroundColor="black"
        }
    </script>
</html>
